package com.by.service.impl;

import com.by.bean.PageBean;
import com.by.mapper.ProductCategoryMapper;
import com.by.query.ProductCategoryQuery;
import com.by.service.ProductCategoryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author :LYJ
 * @version : 1.0
 * @date : 2025/2/26 14:44
 * @desc :
 * @since : JDK17
 */
@Service
@SuppressWarnings("all")
public class ProductCategoryServiceImpl implements ProductCategoryService {
    @Autowired
    ProductCategoryMapper productCategoryMapper;

    @Override
    public PageBean queryAll(ProductCategoryQuery productCategoryQuery) {
        PageHelper.startPage(productCategoryQuery.getPage(), productCategoryQuery.getPageSize());
        List list = productCategoryMapper.queryAll(productCategoryQuery);
        PageInfo info = new PageInfo(list);
        return new PageBean(productCategoryQuery.getPage(), productCategoryQuery.getPageSize(), info.getTotal(), list);
    }
}
